using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

using JetBrains.Annotations;

namespace Rsdn.Janus
{

    public class ForumEntryChangedEventArgs
    {

        private readonly ReadOnlyCollection<ForumEntryIds> _entries;
        private readonly ForumEntryChangeType _changeType;

        /// <summary>
        /// Initializes a new instance of the <see cref="ForumEntryChangedEventArgs"/> class.
        /// </summary>
        /// <param name="entries">The entries.</param>
        /// <param name="changeType">Type of the change.</param>
        public ForumEntryChangedEventArgs([NotNull] IEnumerable<ForumEntryIds> entries, ForumEntryChangeType changeType)
        {
            if (entries == null)
            {
                throw new ArgumentNullException("entries");
            }

            _entries = Array.AsReadOnly(entries.ToArray());
            _changeType = changeType;
        }

        /// <summary>
        /// Gets the entries.
        /// </summary>
        /// <value>The entries.</value>
        public ReadOnlyCollection<ForumEntryIds> Entries
        {
            get
            {
                return _entries;
            }
        }

        /// <summary>
        /// Gets the type of the change.
        /// </summary>
        /// <value>The type of the change.</value>
        public ForumEntryChangeType ChangeType
        {
            get
            {
                return _changeType;
            }
        }
    }
}